home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / Sample Code / Contributed / WASTE / WASTE 1.3 / Private Includes / WASTEIntf.h < prev   
Encoding:
Text File  |  2000-09-28  |  66.1 KB  |  1,560 lines  |  [TEXT/CWIE]

  1. /*
  2.  *    WASTEIntf.h
  3.  *
  4.  *    WASTE PROJECT
  5.  *  Internal (private) interface, version 1.3
  6.  *
  7.  *  Copyright (c) 1993-1998 Marco Piovanelli
  8.  *    All Rights Reserved
  9.  *
  10.  *  C port by Dan Crevier
  11.  *
  12.  */
  13.  
  14. //    Toolbox #includes
  15.  
  16. #ifndef __CONDITIONALMACROS__
  17. #include <ConditionalMacros.h>
  18. #endif
  19.  
  20. #ifndef UNIVERSAL_INTERFACES_VERSION
  21. #error "You need Universal Headers version 2.1 or newer to compile WASTE"
  22. #endif
  23.  
  24. #ifndef __TYPES__
  25. #include <Types.h>
  26. #endif
  27.  
  28. #ifndef __MIXEDMODE__
  29. #include <MixedMode.h>
  30. #endif
  31.  
  32. #ifndef __CODEFRAGMENTS__
  33. #include <CodeFragments.h>
  34. #endif
  35.  
  36. #ifndef __ERRORS__
  37. #include <Errors.h>
  38. #endif
  39.  
  40. #ifndef __GESTALT__
  41. #include <Gestalt.h>
  42. #endif
  43.  
  44. #ifndef __MEMORY__
  45. #include <Memory.h>
  46. #endif
  47.  
  48. #ifndef __FONTS__
  49. #include <Fonts.h>
  50. #endif
  51.  
  52. #ifndef __QUICKDRAWTEXT__
  53. #include <QuickdrawText.h>
  54. #endif
  55.  
  56. #ifndef __QUICKDRAW__
  57. #include <Quickdraw.h>
  58. #endif
  59.  
  60. #ifndef __QDOFFSCREEN__
  61. #include <QDOffscreen.h>
  62. #endif
  63.  
  64. #ifndef __PALETTES__
  65. #include <Palettes.h>
  66. #endif
  67.  
  68. #ifndef __TEXTEDIT__
  69. #include <TextEdit.h>
  70. #endif
  71.  
  72. #ifndef __SCRAP__
  73. #include <Scrap.h>
  74. #endif
  75.  
  76. #ifndef __SCRIPT__
  77. #include <Script.h>
  78. #endif
  79.  
  80. #ifndef __TOOLUTILS__
  81. #include <ToolUtils.h>
  82. #endif
  83.  
  84. #ifndef __TEXTUTILS__
  85. #include <TextUtils.h>
  86. #endif
  87.  
  88. #ifndef __LOWMEM__
  89. #include <LowMem.h>
  90. #endif
  91.  
  92. #ifndef __APPLEEVENTS__
  93. #include <AppleEvents.h>
  94. #endif
  95.  
  96. #ifndef __AEREGISTRY__
  97. #include <AERegistry.h>
  98. #endif
  99.  
  100. #ifndef __DRAG__
  101. #include <Drag.h>
  102. #endif
  103.  
  104. #ifndef __TEXTSERVICES__
  105. #include <TextServices.h>
  106. #endif
  107.  
  108. #ifndef __FIXMATH__
  109. #include <FixMath.h>
  110. #endif
  111.  
  112. //    ANSI #includes
  113.  
  114. #ifndef _LIMITS
  115. #include <limits.h>
  116. #endif
  117.  
  118. //    other #includes
  119.  
  120. #ifndef __LONGCOORDINATES__
  121. #ifndef _LongCoords_
  122. #include "LongCoords.h"
  123. #endif
  124. #endif
  125.  
  126. //    there are slight differences between Universal Headers version 2.1.x and 3.0
  127. //    that need to be addressed here, if WASTE is to support both sets of headers
  128.  
  129. #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x300)
  130.     //    we're using Universal Headers 3.0 or later
  131.     #define        kNullDrag                            nil
  132. #else
  133.     //    we're using Universal Headers 2.1.x: we need to define some additional symbols
  134.     #define        kNullDrag                            0L
  135.     #define        kDragTrackingEnterWindow            dragTrackingEnterWindow
  136.     #define        kDragTrackingInWindow                dragTrackingInWindow
  137.     #define        kDragTrackingLeaveWindow            dragTrackingLeaveWindow
  138.     #define        kDragHasLeftSenderWindow            dragHasLeftSenderWindow
  139.     #define        kDragStandardTranslucency            0L
  140.     typedef        UInt32                                DragImageFlags ;
  141.     extern pascal OSErr SetDragImage(DragReference drag, PixMapHandle imagePixMap,
  142.         RgnHandle imageRgn, Point imageOffsetPt, DragImageFlags imageFlags)
  143.          TWOWORDINLINE(0x7027,0xABED);
  144. #endif
  145.  
  146. // MPW needs topLeft and botRight defined here
  147. #ifndef topLeft
  148. #define topLeft(r)                      (((Point *) &(r))[0])
  149. #endif
  150.  
  151. #ifndef botRight
  152. #define botRight(r)                     (((Point *) &(r))[1])
  153. #endif
  154.  
  155. // pascal-like macros for testing, setting, clearing and inverting bits
  156. #define BTST( FLAGS, BIT )                ((FLAGS) &   (1UL << (BIT)))
  157. #define BSET( FLAGS, BIT )              ((FLAGS) |=  (1UL << (BIT)))
  158. #define BCLR( FLAGS, BIT )              ((FLAGS) &= ~(1UL << (BIT)))
  159. #define BCHG( FLAGS, BIT )              ((FLAGS) ^=  (1UL << (BIT)))
  160.  
  161. // pascal-like macros for shifting bits
  162. #define BSL( A, B )                        (((SInt32) (A)) << (B))
  163. #define BSR( A, B )                        (((SInt32) (A)) >> (B))
  164.  
  165. // macros used in conjunction with the styleRunPosition parameter
  166. #define IS_LEFTMOST_RUN(RUN)            ((RUN) <= leftStyleRun)
  167. #define IS_RIGHTMOST_RUN(RUN)            (! ((RUN) & 0x01))
  168.  
  169. // other macros
  170. #define ABS(A)                             ((A) > 0 ? (A) : -(A))
  171. #define BLOCK_CLR(X)                    _WEBlockClr(&(X), sizeof(X));
  172.  
  173. // define WASTE_VERSION is standard NumVersion format
  174.  
  175. #define WASTE_VERSION                    0x01308000    /* 1.3 */
  176.  
  177. // set WASTE_SHARED_LIBRARY to 1 when building a CFM-based shared library
  178. #ifndef WASTE_SHARED_LIBRARY
  179. #define WASTE_SHARED_LIBRARY            0
  180. #endif
  181.  
  182. //    make sure WASTE_SHARED_LIBRARY is false if building a non-CFM project
  183. #if ( WASTE_SHARED_LIBRARY && ( ! GENERATINGCFM ) )
  184. #error "WASTE_SHARED_LIBRARY must be 0 in a classic 68K project"
  185. #endif
  186.  
  187. // set WASTE_DEBUG to 1 to perform various consistency checks;
  188. // errors will be reported with DebugStr()
  189. // WARNING: when WASTE_DEBUG is set, WEIdle() calls can be extremely time-consuming
  190. #ifndef WASTE_DEBUG
  191. #define WASTE_DEBUG                        0
  192. #endif
  193.  
  194. // set WASTE_OBJECTS to 0 if you don't need embedded objects
  195. #ifndef WASTE_OBJECTS
  196. #define    WASTE_OBJECTS                    1
  197. #endif
  198.  
  199. // set WASTE_TSM_SUPPORT to 0 to disable support for the Text Services Manager
  200. #ifndef WASTE_TSM_SUPPORT
  201. #define WASTE_TSM_SUPPORT                1
  202. #endif
  203.  
  204. // set WASTE_DRAG_AND_DROP to 0 to disable support for the Drag Manager
  205. #ifndef WASTE_DRAG_AND_DROP
  206. #define WASTE_DRAG_AND_DROP                1
  207. #endif
  208.  
  209. // set WASTE_USE_UPPS to 0 if you don't need UPPs
  210. #ifndef WASTE_USE_UPPS
  211. #define WASTE_USE_UPPS                    GENERATINGCFM
  212. #endif
  213.  
  214. // set WASTE_NO_SYNCH to 1 if you don't want WASTE to synchronize keyboard and fonts
  215. #ifndef WASTE_NO_SYNCH
  216. #define WASTE_NO_SYNCH                    0
  217. #endif
  218.  
  219. // set WASTE_NO_RO_CARET to 1 to hide the caret in read-only mode
  220. #ifndef WASTE_NO_RO_CARET
  221. #define WASTE_NO_RO_CARET                1
  222. #endif
  223.  
  224. // set WASTE_IC_SUPPORT to 1 to use Dan Crevier's
  225. // support of URL cmd-clicking through Internet Config
  226. #ifndef WASTE_IC_SUPPORT
  227. #define WASTE_IC_SUPPORT                1
  228. #endif
  229.  
  230. // If WASTE_OBJECTS_ARE_GLYPHS is set to 0 (default), WEGetOffset returns kObjectEdge in
  231. // the edge parameter when thePoint is in the middle half of an object: as a result,
  232. // clicking in the middle of an object immediately _selects_ the object, so that a second
  233. // click immediately following triggers the 'clik' callback (this can be handy to make
  234. // sound objects play when they are double-clicked, for example).
  235.  
  236. // If WASTE_OBJECTS_ARE_GLYPHS is set to 1, WEGetOffset treats embedded objects
  237. // like ordinary glyphs and never returns kObjectEdge in the edge parameter:
  238. // as a result, clicking in the middle of an object always positions the caret either
  239. // to the left or to the right of the object.
  240.  
  241. #ifndef WASTE_OBJECTS_ARE_GLYPHS
  242. #define WASTE_OBJECTS_ARE_GLYPHS        0
  243. #endif
  244.  
  245. // set WASTE_RESOLVE_FONT_DESIGNATORS to false if you don't want WASTE to
  246. // map font designators (the special IDs 0 and 1 that identify the system
  247. // and application fonts, respectively) to the actual font IDs.
  248.  
  249. #ifndef WASTE_RESOLVE_FONT_DESIGNATORS
  250. #define WASTE_RESOLVE_FONT_DESIGNATORS    1
  251. #endif
  252.  
  253. // set WASTE_WECALTEXT_DOES_REDRAW to 1 if you want WECalText()
  254. // to automatically redraw all the text (as in WASTE 1.1 final)
  255.  
  256. #ifndef WASTE_WECALTEXT_DOES_REDRAW
  257. #define WASTE_WECALTEXT_DOES_REDRAW        0
  258. #endif
  259.  
  260. // set WASTE_TRANSLUCENT_DRAGS to 1 if you want to be able to
  261. // use translucent dragging for text
  262.  
  263. #ifndef WASTE_TRANSLUCENT_DRAGS
  264. #define WASTE_TRANSLUCENT_DRAGS            0
  265. #endif
  266.  
  267. // macros for debugging
  268.  
  269. #if WASTE_DEBUG
  270. #define WEASSERT(CONDITION, WARNING)    { if (!(CONDITION)) DebugStr(WARNING); }
  271. #else
  272. #define WEASSERT(CONDITION, WARNING)
  273. #endif
  274.  
  275. // determine if inline functions are supported
  276.  
  277. #if defined(__cplusplus) || defined(__MWERKS__)
  278. #define INLINE inline
  279. #else
  280. #define INLINE static
  281. #endif
  282.  
  283. // result codes
  284. enum
  285. {
  286.     weCantUndoErr                =    -10015,    // undo buffer is clear (= errAECantUndo)
  287.     weEmptySelectionErr            =    -10013,    // selection range is empty (= errAENoUserSelection)
  288.     weUnknownObjectTypeErr        =    -9478,    // specified object type is not registered
  289.     weObjectNotFoundErr            =    -9477,    // no object found at specified offset
  290.     weReadOnlyErr                =    -9476,    // instance is read-only
  291.     weMonoStyledErr                =    -9475,    // instance is mono-styled
  292.     weNotHandledErr                =    -1708,  // please use default handling (= errAEEventNotHandled)
  293.     weNewerVersionErr            =    -1706,    // need a newer version of WASTE (= errAENewerVersion)
  294.     weCorruptDataErr            =    -1702,    // corrupt data (= errAECorruptData)
  295.     weProtocolErr                =    -603,    // improper call order (= protocolErr)
  296.     weUndefinedSelectorErr        =    -50,    // unknown selector
  297.     weNoDragErr                 =     128        // can be returned internally by _WEDrag
  298. };
  299.  
  300. // values for WEInstallObjectHandler handlerSelector parameter
  301. enum
  302. {
  303.     weNewHandler         =     'new ',
  304.     weDisposeHandler     =     'free',
  305.     weDrawHandler         =     'draw',
  306.     weClickHandler         =     'clik',
  307.     weStreamHandler        =    'strm'
  308. };
  309.  
  310. // action kinds
  311. enum
  312. {
  313.     weAKNone            =    0,        // null action
  314.     weAKUnspecified        =    1,        // action of unspecified nature
  315.     weAKTyping            =    2,        // some text has been typed in
  316.     weAKCut                =    3,        // the selection range has been cut
  317.     weAKPaste            =    4,        // something has been pasted
  318.     weAKClear            =    5,        // the selection range has been deleted
  319.     weAKDrag            =    6,        // drag and drop operation
  320.     weAKSetStyle        =    7        // some style has been applied to a text range
  321. };
  322.  
  323. // action flags
  324. enum
  325. {
  326.     weAFIsRedo            =    0x0001,    // action saves edit state prior to a WEUndo call
  327.     weAFDontSaveText    =    0x0002, // don't save text
  328.     weAFDontSaveStyles    =    0x0004,    // don't save styles
  329.     weAFDontSaveSoup    =    0x0008    // don't save soup
  330. };
  331.  
  332. // destination kinds for streaming objects
  333. enum
  334. {
  335.     weToScrap            =    0,
  336.     weToDrag            =    1,
  337.     weToSoup            =    2
  338. };
  339.  
  340. // alignment styles
  341. enum
  342. {
  343.     weFlushLeft         =    -2,        // flush left
  344.     weFlushRight        =    -1,        // flush right
  345.     weFlushDefault        =     0,        // flush according to system direction
  346.     weCenter            =     1,        // centered
  347.     weJustify            =     2        // fully justified
  348. };
  349.  
  350. // dominant line directions
  351. enum
  352. {
  353.     weDirRightToLeft    =    -1,        // right-to-left
  354.     weDirLeftToRight    =     0,        // left-to-right
  355.     weDirDefault        =     1        // according to system direction
  356. };
  357.  
  358. #define IsRightToLeft(direction)    (((direction) == weDirRightToLeft) || (((direction) == weDirDefault) && (GetSysDirection() != 0)))
  359.  
  360. // values for the edge parameter
  361. enum
  362. {
  363.     kLeadingEdge         =     -1,        // point is on the leading edge of a glyph
  364.     kTrailingEdge         =      0,        // point is on the trailing edge of a glyph
  365.     kObjectEdge         =      2        // point is inside an embedded object
  366. };
  367.  
  368. // control character codes
  369. enum
  370. {
  371.     kObjectMarker         =    0x01,
  372.     kBackspace             =    0x08,
  373.     kTab                 =    0x09,
  374.     kEOL                 =    0x0D,
  375.     kArrowLeft             =    0x1C,
  376.     kArrowRight         =    0x1D,
  377.     kArrowUp             =    0x1E,
  378.     kArrowDown             =    0x1F,
  379.     kSpace                 =      0x20,
  380.     kForwardDelete         =    0x7F
  381. };
  382.  
  383. // bit equates for the tsFlags field of the WETextStyle record
  384. enum
  385. {
  386.     tsTSMHilite         =    4,        // set if style run is part of active input area
  387.     tsTSMSelected         =    5,        // set for selected raw/converted text
  388.     tsTSMConverted         =    6,        // set for converted text, clear for raw text
  389.     tsRightToLeft         =    7        // set for right-to-left runs
  390. };
  391.  
  392. // bit equates for the mode parameter in WESetStyle and WEContinuousStyle
  393. enum
  394. {
  395.     kModeFont             =    0,        // change font
  396.     kModeFace             =    1,        // change Quickdraw styles
  397.     kModeSize             =    2,        // change point size
  398.     kModeColor             =    3,        // change color
  399.     kModeAddSize         =    4,        // add tsSize to existing size
  400.     kModeToggleFace     =    5,        // toggle continuous styles rather than setting them
  401.     kModeReplaceFace     =    6,        // tsFace replaces existing styles outright
  402.     kModePreserveScript =    7,        // apply font to runs of same script only
  403.     kModeExtractSubscript = 8,        // apply font to eligible subruns of different script
  404.     kModeFaceMask         =     9,        // change Quickdraw styles; use mask
  405.     kModeObject         =     14,        // change tsObject field
  406.     kModeFlags             =     15        // change tsFlags field
  407. };
  408.  
  409. // values for the mode parameter in WESetStyle and WEContinuousStyle
  410. enum
  411. {
  412.     weDoFont                =    1 << kModeFont,
  413.     weDoFace                =    1 << kModeFace,
  414.     weDoSize                =    1 << kModeSize,
  415.     weDoColor                =    1 << kModeColor,
  416.     weDoAll                    =    weDoFont + weDoFace + weDoSize + weDoColor,
  417.     weDoAddSize                =    1 << kModeAddSize,
  418.     weDoToggleFace            =    1 << kModeToggleFace,
  419.     weDoReplaceFace            =    1 << kModeReplaceFace,
  420.     weDoPreserveScript        =    1 << kModePreserveScript,
  421.     weDoSmartFont            =    weDoFont + weDoPreserveScript,
  422.     weDoExtractSubscript    =    1 << kModeExtractSubscript,
  423.     weDoFaceMask            =    1 << kModeFaceMask,
  424.     weDoObject                =    1 << kModeObject,
  425.     weDoFlags                =    1 << kModeFlags
  426. };
  427.  
  428. // values for WEFeatureFlag action parameter
  429. enum
  430. {
  431.     weBitSet             =     1,        // enables the specified feature
  432.     weBitClear             =     0,        // disables the specified feature
  433.     weBitTest             =    -1,        // returns the current setting of the specified feature
  434.     weBitToggle         =    -2        // toggles the specified feature
  435. };
  436.  
  437. // bit equates for the flags field in the WE record
  438. enum
  439. {
  440.     weFHasColorQD             =    31,        // Color Quickdraw is available
  441.     weFHasDragManager         =    30,        // the Drag Manager is available
  442.     weFHasTextServices        =    29,        // the Text Services Manager is available
  443.     weFNonRoman                =    28,        // at least one non-Roman script is enabled
  444.     weFDoubleByte            =    27,        // a double-byte script is enabled
  445.     weFBidirectional        =    26,        // a bidirectional script is enabled
  446.     weFCaretRight            =    25,        // set if caret was drawn for R-L keyboard script
  447.     weFCaretVisible            =    24,        // the caret is currently visible
  448.     weFMouseTracking        =    23,        // set internally during mouse tracking
  449.     weFAnchorIsEnd            =    22,        // anchor offset is selEnd
  450.     weFUseNullStyle            =    21,        // a null style is associated with the empty selection
  451.     weFActive                =    20,        // we're active
  452.     weFHilited                =    19,        // true if text pane is highlighted (for Drag & Drop)
  453.     weFCanAcceptDrag        =    18,        // the drag in the text pane can be accepted
  454.     weFDragCaretVisible        =    17,        // drag caret is currently visible
  455.     weFDestRectChanged        =    16,        // set if scroll callback needs to be called
  456.     weFHasTranslucentDrags    =    15,        // SetDragImage is available
  457.     weFAccumulateUndos        =    14        // don't clear undo stack before new change
  458. };
  459.  
  460. // bit equates for the features field in the WE record
  461. enum
  462. {
  463.     weFInhibitColor        =    31,        // draw in black & white only; ignore color
  464.     weFMonoStyled        =    13,        // disallow style changes
  465.     weFInhibitRedraw    =    12,        // don't redraw text
  466.     weFDrawOffscreen    =    11,        // draw text offscreen for smoother visual results
  467.     weFUseTempMem        =    10,        // use temporary memory for main data structures
  468.     weFInhibitRecal        =     9,        // don't recalculate line breaks and don't redraw text
  469.     weFDragAndDrop        =     8,        // support drag and drop
  470.     weFIntCutAndPaste    =     7,        // intelligent cut & paste
  471.     weFUndoSupport        =     6,        // support undo/redo
  472.     weFReadOnly            =     5,        // disallow editing
  473.     weFOutlineHilite    =     2,        // frame selection range when text pane is inactive
  474.     weFAutoScroll        =     0        // automatically scroll text when cursor is outside pane
  475. };
  476.  
  477. // scrap types
  478. enum
  479. {
  480.     kTypeText            =    'TEXT',
  481.     kTypeStyles         =    'styl',
  482.     kTypeSoup             =    'SOUP',
  483.     kTypeFontTable        =    'FISH'
  484. };
  485.  
  486. // selectors for WEGetInfo/WESetInfo
  487. enum
  488. {
  489.     weCharByteHook            =    'cbyt',
  490.     weCharTypeHook            =    'ctyp',
  491.     weCharToPixelHook        =    'c2p ',
  492.     weClickLoop                =    'clik',
  493.     weCurrentDrag            =    'drag',
  494.     weDrawTextHook            =    'draw',
  495.     weEraseHook                =    'eras',
  496.     weFluxProc                =    'flux',
  497.     weHiliteDropAreaHook    =    'hidr',
  498.     weLineArray                =    'line',
  499.     weLineBreakHook            =    'lbrk',
  500.     wePixelToCharHook        =    'p2c ',
  501.     wePort                    =    'port',
  502.     wePreTrackDragHook        =    'ptrk',
  503.     weRefCon                =    'refc',
  504.     weRunArray                =    'runa',
  505.     weScrollProc            =    'scrl',
  506.     weStyleTable            =    'styl',
  507.     weText                    =    'text',
  508.     weTranslateDragHook        =    'xdrg',
  509.     weTranslucencyThreshold    =    'tluc',
  510.     weTSMDocumentID            =    'tsmd',
  511.     weTSMPostUpdate            =    'post',
  512.     weTSMPreUpdate            =    'pre ',
  513.     weURLHint                =    'urlh',
  514.     weWordBreakHook            =    'wbrk'
  515. };
  516.  
  517. // possible values returned by WEIntelligentPaste
  518. enum
  519. {
  520.     weDontAddSpaces            =     0,
  521.     weAddSpaceOnLeftSide    =    -1,
  522.     weAddSpaceOnRightSide    =     1
  523. };
  524.  
  525. // values for WEAllocate allocFlags parameter
  526. enum
  527. {
  528.     kAllocClear            =    0x00000001,    // clear handle after allocation
  529.     kAllocTemp            =    0x00000002    // use temporary memory if available
  530. };
  531.  
  532. // other miscellaneous constants
  533. enum
  534. {
  535.     kCaretWidth = 1,            // width of the caret, in pixels
  536.     kMinFontSize = 1,            // minimum valid font size
  537.     kMaxFontSize = SHRT_MAX,    // maximum valid font size
  538.     kInvalidOffset = -1,         // used to flag an invalid or nonexistent offset
  539.     kUnknownObjectType = -1,    // returned by _WELookupObjectType for unknown flavors
  540.     kTextMargin = 3,            // width of border area surrounding the text (in pixels)
  541.     kMaxScrollDelta = 30,        // maximum scroll amount used by standard click loop
  542.     kAutoScrollDelay = 10,        // delay before auto-scroll starts (in ticks)
  543.     kDefaultObjectHeight = 32,    // default height for new objects
  544.     kDefaultObjectWidth = 32,    // default width for new objects
  545.     kAutoOrderingSize = 32        // size of stack-based format array used by _WESegmentLoop
  546. };
  547.  
  548. #if PRAGMA_ALIGN_SUPPORTED
  549. #pragma options align=mac68k
  550. #endif
  551.  
  552. typedef UInt16 WEStyleMode;
  553. typedef SInt8 WEAlignment;
  554. typedef SInt16 WEDirection;
  555. typedef SInt8 WEEdge;
  556. typedef SInt16 WEActionKind;
  557. typedef UInt16 WEActionFlags;
  558.  
  559. // forward declarations
  560.  
  561. typedef struct WERec *WEPtr, **WEHandle;
  562. typedef struct WEObjectDesc **WEObjectDescHandle;
  563.  
  564. typedef struct WETextStyle
  565. {
  566.     SInt16 tsFont;                    // font family number
  567.     Style tsFace;                    // set of Quickdraw styles
  568.     UInt8 tsFlags;                    // flags (FOR INTERNAL USE ONLY)
  569.     SInt16 tsSize;                    // font size, in integer points
  570.     RGBColor tsColor;                // absolute red-green-blue color
  571. #if WASTE_OBJECTS
  572.     WEObjectDescHandle tsObject;    // embedded object reference
  573. #endif
  574. } WETextStyle;
  575.  
  576. typedef struct WERunAttributes
  577. {
  578.     SInt16 runHeight;            // style run height (ascent + descent + leading)
  579.     SInt16 runAscent;            // font ascent
  580.     WETextStyle runStyle;        // text style
  581. } WERunAttributes;
  582.  
  583. typedef struct WERunInfo
  584. {
  585.     SInt32 runStart;            // byte offset to first character of this style run
  586.     SInt32 runEnd;                // byte offset to first character of next style run
  587.     WERunAttributes runAttrs;    // run attributes
  588. } WERunInfo;
  589.  
  590. typedef struct QDEnvironment
  591. {
  592.     GrafPtr envPort;
  593.     PenState envPen;
  594.     WETextStyle envStyle;
  595.     SInt16 envMode;
  596. } QDEnvironment;
  597.  
  598. typedef struct WERunArrayEntry
  599. {
  600.     SInt32 runStart;            // offset to first character in style run
  601.     SInt32 styleIndex;            // index into style table
  602. } WERunArrayEntry, **WERunArrayHandle;
  603.  
  604. typedef struct TERunAttributes
  605. {
  606.     SInt16 runHeight;
  607.     SInt16 runAscent;
  608.     TextStyle runTEStyle;
  609. } TERunAttributes;
  610.  
  611. typedef struct TEStyleScrapElement
  612. {
  613.     SInt32 scrpStartChar;
  614.     TERunAttributes scrpTEAttrs;
  615. } TEStyleScrapElement;
  616.  
  617. typedef struct TEStyleScrap
  618. {
  619.     SInt16 scrpNStyles;
  620.     TEStyleScrapElement scrpStyleTab[ kVariableLengthArray ];
  621. } TEStyleScrap, **TEStyleScrapHandle;
  622.  
  623. typedef struct WEStyleTableEntry
  624. {
  625.     SInt32 refCount;            // reference count
  626.     WERunAttributes info;        // style information
  627. } WEStyleTableEntry, **WEStyleTableHandle;
  628.  
  629. typedef struct WELineRec
  630. {
  631.     SInt32 lineStart;            // byte offset to first character in line
  632.     SInt32 lineOrigin;            // pixel offset from destRect.top
  633.     SInt16 lineAscent;            // maximum font ascent for this line
  634.     SInt16 lineSlop;            // extra pixels needed to fill up the line
  635.     Fixed lineJustAmount;        // normalized slop value, used for justification
  636. } WELineRec, **WELineArrayHandle;
  637.  
  638. typedef struct WEAction
  639. {
  640.     WEHandle hOwner;            // handle to associated WE instance
  641.     struct WEAction **hNext;    // used to keep a linked list of actions
  642.     Handle hText;                // handle to saved text
  643.     Handle hStyles;                // handle to saved styles
  644.     Handle hSoup;                // handle to saved soup
  645.     SInt32 delRangeStart;        // start of range to delete
  646.     SInt32 delRangeLength;        // length of range to delete
  647.     SInt32 insRangeLength;        // lenfth of range to insert
  648.     SInt32 hiliteStart;            // start of range to hilite
  649.     SInt32 hiliteEnd;            // end of range to hilite
  650.     WEActionKind actionKind;    // identifies event that caused this action to be pushed
  651.     WEActionFlags actionFlags;    // miscellaneous flags
  652. } WEAction, **WEActionHandle;
  653.  
  654. // A WESoup record is a static description of an object embedded in the text.
  655. // The 'SOUP' data type is just a collection of WESoup records, each followed
  656. // by the corresponding object data.
  657. // This data type complements the standard TEXT/styl pair.
  658.  
  659. typedef struct WESoup
  660. {
  661.     SInt32 soupOffset;            // insertion offset for this object
  662.     FlavorType soupType;        // 4-letter tag identifying object type
  663.     SInt32 soupReserved1;        // reserved for future use; set to zero
  664.     Size soupDataSize;            // size of object data following this record
  665.     Point soupSize;                // object height and width, in pixels
  666.     SInt32 soupReserved2;        // reserved for future use; set to zero
  667. } WESoup;
  668.  
  669. // callback prototypes
  670.  
  671. typedef pascal Boolean (*WEClickLoopProcPtr)(WEHandle hWE);
  672. typedef pascal void (*WEScrollProcPtr)(WEHandle hWE);
  673. typedef pascal void (*WETSMPreUpdateProcPtr)(WEHandle hWE);
  674. typedef pascal void (*WETSMPostUpdateProcPtr)(WEHandle hWE,
  675.         SInt32 fixLength, SInt32 inputAreaStart, SInt32 inputAreaEnd,
  676.         SInt32 pinRangeStart, SInt32 pinRangeEnd);
  677. typedef pascal OSErr (*WEPreTrackDragProcPtr)(DragReference drag, WEHandle hWE);
  678. typedef pascal OSErr (*WETranslateDragProcPtr)(DragReference drag,
  679.         ItemReference dragItem, FlavorType requestedType, Handle putDataHere,
  680.         SInt32 dropOffset, WEHandle hWE);
  681. typedef pascal OSErr (*WEHiliteDropAreaProcPtr)(DragReference drag,
  682.         Boolean hiliteFlag, WEHandle hWE);
  683. typedef pascal OSErr (*WEFontIDToNameProcPtr)(SInt16 fontID, Str255 fontName);
  684. typedef pascal OSErr (*WEFontNameToIDProcPtr)(ConstStr255Param fontName, SInt16 oldFontID, SInt16 *newFontID);
  685. typedef pascal void (*WEDrawTextProcPtr)(Ptr pText, SInt32 textLength, Fixed slop,
  686.         JustStyleCode styleRunPosition, WEHandle hWE);
  687. typedef pascal SInt32 (*WEPixelToCharProcPtr)(Ptr pText, SInt32 textLength, Fixed slop,
  688.         Fixed *pixelWidth, WEEdge *edge, JustStyleCode styleRunPosition, Fixed hPos, WEHandle hWE);
  689. typedef pascal SInt16 (*WECharToPixelProcPtr)(Ptr pText, SInt32 textLength, Fixed slop,
  690.         SInt32 offset, SInt16 direction, JustStyleCode styleRunPosition, SInt16 hPos, WEHandle hWE);
  691. typedef pascal StyledLineBreakCode (*WELineBreakProcPtr)(Ptr pText, SInt32 textLength,
  692.         SInt32 textStart, SInt32 textEnd, Fixed *textWidth, SInt32 *textOffset, WEHandle hWE);
  693. typedef pascal void (*WEWordBreakProcPtr)(Ptr pText, SInt16 textLength, SInt16 offset,
  694.         WEEdge edge, OffsetTable breakOffsets, ScriptCode script, WEHandle hWE);
  695. typedef pascal SInt16 (*WECharByteProcPtr)(Ptr pText, SInt16 textOffset, ScriptCode script,
  696.         WEHandle hWE);
  697. typedef pascal SInt16 (*WECharTypeProcPtr)(Ptr pText, SInt16 textOffset, ScriptCode script, WEHandle hWE);
  698. typedef pascal void (*WEEraseProcPtr)(const Rect *area, WEHandle hWE);
  699. typedef pascal void (*WEFluxProcPtr)(SInt32 offset, SInt32 delta, WEHandle hWE);
  700. typedef pascal OSErr (*WENewObjectProcPtr)(Point *defaultObjectSize,
  701.         WEObjectDescHandle hObjectDesc);
  702. typedef pascal OSErr (*WEDisposeObjectProcPtr)(WEObjectDescHandle hObjectDesc);
  703. typedef pascal OSErr (*WEDrawObjectProcPtr)(const Rect *destRect,
  704.         WEObjectDescHandle hObjectDesc);
  705. typedef pascal Boolean (*WEClickObjectProcPtr)(Point hitPt, EventModifiers modifiers, UInt32 clickTime,
  706.         WEObjectDescHandle hObjectDesc);
  707. typedef pascal OSErr (*WEStreamObjectProcPtr)(SInt16 destKind, FlavorType *theType, Handle putDataHere, WEObjectDescHandle hObjectDesc);
  708.  
  709.  
  710. // UPP proc info
  711.  
  712. enum
  713. {
  714.     uppWEClickLoopProcInfo = kPascalStackBased
  715.         | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  716.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEHandle /*hWE*/))),
  717.     uppWEScrollProcInfo = kPascalStackBased
  718.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEHandle /*hWE*/))),
  719.     uppWETSMPreUpdateProcInfo = kPascalStackBased
  720.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEHandle /*hWE*/))),
  721.     uppWETSMPostUpdateProcInfo = kPascalStackBased
  722.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEHandle /*hWE*/)))
  723.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt32 /*fixLength*/)))
  724.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(SInt32 /*inputAreaStart*/)))
  725.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(SInt32 /*inputAreaEnd*/)))
  726.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(SInt32 /*pinRangeStart*/)))
  727.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(SInt32 /*pinRangeEnd*/))),
  728.     uppWEPreTrackDragProcInfo = kPascalStackBased
  729.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  730.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(DragReference /*drag*/)))
  731.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(WEHandle /*hWE*/))),
  732.     uppWETranslateDragProcInfo = kPascalStackBased
  733.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  734.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(DragReference /*drag*/)))
  735.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(ItemReference /*dragItem*/)))
  736.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(FlavorType /*requestedType*/)))
  737.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(Handle /*putDataHere*/)))
  738.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(SInt32 /*dropOffset*/)))
  739.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(WEHandle /*hWE*/))),
  740.     uppWEHiliteDropAreaProcInfo = kPascalStackBased
  741.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  742.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(DragReference /*drag*/)))
  743.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(Boolean /*hiliteFlag*/)))
  744.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(WEHandle /*hWE*/))),
  745.     uppWEFontIDToNameProcInfo = kPascalStackBased
  746.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  747.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(SInt16 /*fontID*/)))
  748.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(StringPtr /*fontName*/))),
  749.     uppWEFontNameToIDProcInfo = kPascalStackBased
  750.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  751.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(ConstStr255Param /*fontName*/)))
  752.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt16 /*oldFontID*/)))
  753.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(SInt16 * /*newFontID*/))),
  754.     uppWEDrawTextProcInfo = kPascalStackBased
  755.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  756.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt32 /*textLength*/)))
  757.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(Fixed /*slop*/)))
  758.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(JustStyleCode /*styleRunPosition*/)))
  759.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(WEHandle /*hWE*/))),
  760.     uppWEPixelToCharProcInfo = kPascalStackBased
  761.         | RESULT_SIZE(SIZE_CODE(sizeof(SInt32)))
  762.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  763.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt32 /*textLength*/)))
  764.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(Fixed /*slop*/)))
  765.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(Fixed * /*pixelWidth*/)))
  766.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(WEEdge * /*edge*/)))
  767.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(JustStyleCode /*styleRunPosition*/)))
  768.         | STACK_ROUTINE_PARAMETER(7,SIZE_CODE(sizeof(Fixed /*hPos*/)))
  769.         | STACK_ROUTINE_PARAMETER(8,SIZE_CODE(sizeof(WEHandle /*hWE*/))),
  770.     uppWECharToPixelProcInfo = kPascalStackBased
  771.         | RESULT_SIZE(SIZE_CODE(sizeof(SInt16)))
  772.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  773.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt32 /*textLength*/)))
  774.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(Fixed /*slop*/)))
  775.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(SInt32 /*offset*/)))
  776.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(SInt16 /*direction*/)))
  777.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(JustStyleCode /*styleRunPosition*/)))
  778.         | STACK_ROUTINE_PARAMETER(7,SIZE_CODE(sizeof(SInt16 /*hPos*/)))
  779.         | STACK_ROUTINE_PARAMETER(8,SIZE_CODE(sizeof(WEHandle /*hWE*/))),
  780.     uppWELineBreakProcInfo = kPascalStackBased
  781.         | RESULT_SIZE(SIZE_CODE(sizeof(StyledLineBreakCode )))
  782.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  783.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt32 /*textLength*/)))
  784.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(SInt32 /*textStart*/)))
  785.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(SInt32 /*textEnd*/)))
  786.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(Fixed * /*textWidth*/)))
  787.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(SInt32 * /*textOffset*/)))
  788.         | STACK_ROUTINE_PARAMETER(7,SIZE_CODE(sizeof(WEHandle /*hWE*/))),
  789.     uppWEWordBreakProcInfo = kPascalStackBased
  790.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  791.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt16 /*textLength*/)))
  792.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(SInt16 /*offset*/)))
  793.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(WEEdge /*edge*/)))
  794.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(OffsetTable * /*breakOffsets*/)))
  795.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(ScriptCode /*script*/)))
  796.         | STACK_ROUTINE_PARAMETER(7,SIZE_CODE(sizeof(WEHandle /*hWE*/))),
  797.     uppWECharByteProcInfo = kPascalStackBased
  798.         | RESULT_SIZE(SIZE_CODE(sizeof(SInt16 )))
  799.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  800.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt16 /*textOffset*/)))
  801.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(ScriptCode /*script*/)))
  802.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(WEHandle /*hWE*/))),
  803.     uppWECharTypeProcInfo = kPascalStackBased
  804.         | RESULT_SIZE(SIZE_CODE(sizeof(SInt16 )))
  805.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  806.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt16 /*textOffset*/)))
  807.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(ScriptCode /*script*/)))
  808.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(WEHandle /*hWE*/))),
  809.     uppWEEraseProcInfo = kPascalStackBased
  810.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(const Rect * /*area*/)))
  811.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(WEHandle /*hWE*/))),
  812.     uppWEFluxProcInfo = kPascalStackBased
  813.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(SInt32 /*offset*/)))
  814.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt32 /*delta*/)))
  815.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(WEHandle /*hWE*/))),
  816.     uppWENewObjectProcInfo = kPascalStackBased
  817.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  818.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Point * /*defaultObjectSize*/)))
  819.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(WEObjectDescHandle /*hObjectDesc*/))),
  820.     uppWEDisposeObjectProcInfo = kPascalStackBased
  821.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  822.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEObjectDescHandle /*hObjectDesc*/))),
  823.     uppWEDrawObjectProcInfo = kPascalStackBased
  824.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  825.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(const Rect * /*destRect*/)))
  826.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(WEObjectDescHandle /*hObjectDesc*/))),
  827.     uppWEClickObjectProcInfo = kPascalStackBased
  828.         | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  829.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Point /*hitPt*/)))
  830.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt16 /*modifiers*/)))
  831.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(UInt32 /*clickTime*/)))
  832.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(WEObjectDescHandle /*hObjectDesc*/))),
  833.     uppWEStreamObjectProcInfo = kPascalStackBased
  834.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  835.         | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(SInt16 /*destKind*/)))
  836.         | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(FlavorType * /*theType*/)))
  837.         | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Handle /*putDataHere*/)))
  838.         | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(WEObjectDescHandle /*hObjectDesc*/)))
  839. };
  840.  
  841.  
  842. /*    UPPs, New≈Proc macros & Call≈Proc macros */
  843.  
  844. /*
  845.     NOTE:
  846.     For compatibility with the Pascal version, Call≈Proc macros take the form:
  847.  
  848.         CallFooProc(..., userRoutine)
  849.  
  850.     instead of:
  851.  
  852.         CallFooProc(userRoutine, ...)
  853.  
  854. */
  855.  
  856. #if WASTE_USE_UPPS
  857.  
  858. typedef UniversalProcPtr WEClickLoopUPP;
  859. typedef UniversalProcPtr WEScrollUPP;
  860. typedef UniversalProcPtr WETSMPreUpdateUPP;
  861. typedef UniversalProcPtr WETSMPostUpdateUPP;
  862. typedef UniversalProcPtr WEPreTrackDragUPP;
  863. typedef UniversalProcPtr WETranslateDragUPP;
  864. typedef UniversalProcPtr WEHiliteDropAreaUPP;
  865. typedef UniversalProcPtr WEFontIDToNameUPP;
  866. typedef UniversalProcPtr WEFontNameToIDUPP;
  867. typedef UniversalProcPtr WEDrawTextUPP;
  868. typedef UniversalProcPtr WEPixelToCharUPP;
  869. typedef UniversalProcPtr WECharToPixelUPP;
  870. typedef UniversalProcPtr WELineBreakUPP;
  871. typedef UniversalProcPtr WEWordBreakUPP;
  872. typedef UniversalProcPtr WECharByteUPP;
  873. typedef UniversalProcPtr WECharTypeUPP;
  874. typedef UniversalProcPtr WEEraseUPP;
  875. typedef UniversalProcPtr WEFluxUPP;
  876. typedef UniversalProcPtr WENewObjectUPP;
  877. typedef UniversalProcPtr WEDisposeObjectUPP;
  878. typedef UniversalProcPtr WEDrawObjectUPP;
  879. typedef UniversalProcPtr WEClickObjectUPP;
  880. typedef UniversalProcPtr WEStreamObjectUPP;
  881.  
  882. #define NewWEClickLoopProc(userRoutine) \
  883.     (WEClickLoopUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEClickLoopProcInfo, GetCurrentArchitecture())
  884. #define NewWEScrollProc(userRoutine) \
  885.     (WEScrollUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEScrollProcInfo, GetCurrentArchitecture())
  886. #define NewWETSMPreUpdateProc(userRoutine) \
  887.     (WETSMPreUpdateUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWETSMPreUpdateProcInfo, GetCurrentArchitecture())
  888. #define NewWETSMPostUpdateProc(userRoutine) \
  889.     (WETSMPostUpdateUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWETSMPostUpdateProcInfo, GetCurrentArchitecture())
  890. #define NewWEPreTrackDragProc(userRoutine) \
  891.     (WEPreTrackDragUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEPreTrackDragProcInfo, GetCurrentArchitecture())
  892. #define NewWETranslateDragProc(userRoutine) \
  893.     (WETranslateDragUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWETranslateDragProcInfo, GetCurrentArchitecture())
  894. #define NewWEHiliteDropAreaProc(userRoutine) \
  895.     (WEHiliteDropAreaUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEHiliteDropAreaProcInfo, GetCurrentArchitecture())
  896. #define NewWEFontIDToNameProc(userRoutine) \
  897.     (WEFontIDToNameUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEFontIDToNameProcInfo, GetCurrentArchitecture())
  898. #define NewWEFontNameToIDProc(userRoutine) \
  899.     (WEFontNameToIDUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEFontNameToIDProcInfo, GetCurrentArchitecture())
  900. #define NewWEDrawTextProc(userRoutine) \
  901.     (WEDrawTextUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEDrawTextProcInfo, GetCurrentArchitecture())
  902. #define NewWEPixelToCharProc(userRoutine) \
  903.     (WEPixelToCharUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEPixelToCharProcInfo, GetCurrentArchitecture())
  904. #define NewWECharToPixelProc(userRoutine) \
  905.     (WECharToPixelUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWECharToPixelProcInfo, GetCurrentArchitecture())
  906. #define NewWELineBreakProc(userRoutine) \
  907.     (WELineBreakUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWELineBreakProcInfo, GetCurrentArchitecture())
  908. #define NewWEWordBreakProc(userRoutine) \
  909.     (WEWordBreakUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEWordBreakProcInfo, GetCurrentArchitecture())
  910. #define NewWECharByteProc(userRoutine) \
  911.     (WECharByteUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWECharByteProcInfo, GetCurrentArchitecture())
  912. #define NewWECharTypeProc(userRoutine) \
  913.     (WECharTypeUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWECharTypeProcInfo, GetCurrentArchitecture())
  914. #define NewWEEraseProc(userRoutine) \
  915.     (WEEraseUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEEraseProcInfo, GetCurrentArchitecture())
  916. #define NewWEFluxProc(userRoutine) \
  917.     (WEFluxUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEFluxProcInfo, GetCurrentArchitecture())
  918. #define NewWENewObjectProc(userRoutine) \
  919.     (WENewObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWENewObjectProcInfo, GetCurrentArchitecture())
  920. #define NewWEDisposeObjectProc(userRoutine) \
  921.     (WEDisposeObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEDisposeObjectProcInfo, GetCurrentArchitecture())
  922. #define NewWEDrawObjectProc(userRoutine) \
  923.     (WEDrawObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEDrawObjectProcInfo, GetCurrentArchitecture())
  924. #define NewWEClickObjectProc(userRoutine) \
  925.     (WEClickObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEClickObjectProcInfo, GetCurrentArchitecture())
  926. #define NewWEStreamObjectProc(userRoutine) \
  927.     (WEStreamObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEStreamObjectProcInfo, GetCurrentArchitecture())
  928.  
  929. #define CallWEClickLoopProc(hWE, userRoutine) \
  930.     CallUniversalProc((userRoutine), uppWEClickLoopProcInfo, (hWE))
  931. #define CallWEScrollProc(hWE, userRoutine) \
  932.     CallUniversalProc((userRoutine), uppWEScrollProcInfo, (hWE))
  933. #define CallWETSMPreUpdateProc(hWE, userRoutine) \
  934.     CallUniversalProc((userRoutine), uppWETSMPreUpdateProcInfo, (hWE))
  935. #define CallWETSMPostUpdateProc(hWE, fixLength, inputAreaStart, inputAreaEnd, pinRangeStart, pinRangeEnd, userRoutine) \
  936.     CallUniversalProc((userRoutine), uppWETSMPostUpdateProcInfo, (hWE), (fixLength), (inputAreaStart), (inputAreaEnd), (pinRangeStart), (pinRangeEnd))
  937. #define CallWEPreTrackDragProc(drag, hWE, userRoutine) \
  938.     CallUniversalProc((userRoutine), uppWEPreTrackDragProcInfo, (drag), (hWE))
  939. #define CallWETranslateDragProc(drag, dragItem, requestedType, putDataHere, dropOffset, hWE, userRoutine) \
  940.     CallUniversalProc((userRoutine), uppWETranslateDragProcInfo, (drag), (dragItem), (requestedType), (putDataHere), (dropOffset), (hWE))
  941. #define CallWEHiliteDropAreaProc(drag, hiliteFlag, hWE, userRoutine) \
  942.     CallUniversalProc((userRoutine), uppWEHiliteDropAreaProcInfo, (drag), (hiliteFlag), (hWE))
  943. #define CallWEFontIDToNameProc(fontID, fontName, userRoutine) \
  944.     CallUniversalProc((userRoutine), uppWEFontIDToNameProcInfo, (fontID), (fontName))
  945. #define CallWEFontNameToIDProc(fontName, oldFontID, fontID, userRoutine) \
  946.     CallUniversalProc((userRoutine), uppWEFontNameToIDProcInfo, (fontName), (oldFontID), (fontID))
  947. #define CallWEDrawTextProc(pText, textLength, slop, styleRunPosition, hWE, userRoutine) \
  948.     CallUniversalProc((userRoutine), uppWEDrawTextProcInfo, (pText), (textLength), (slop), (styleRunPosition), (hWE))
  949. #define CallWEPixelToCharProc(pText, textLength, slop, pixelWidth, edge, styleRunPosition, hPos, hWE, userRoutine) \
  950.     CallUniversalProc((userRoutine), uppWEPixelToCharProcInfo, (pText), (textLength), (slop), (pixelWidth), (edge), (styleRunPosition), (hPos), (hWE))
  951. #define CallWECharToPixelProc(pText, textLength, slop, offset, direction, styleRunPosition, hPos, hWE, userRoutine) \
  952.     CallUniversalProc((userRoutine), uppWECharToPixelProcInfo, (pText), (textLength), (slop), (offset), (direction), (styleRunPosition), (hPos), (hWE))
  953. #define CallWELineBreakProc(pText, textLength, textStart, textEnd, textWidth, textOffset, hWE, userRoutine) \
  954.     CallUniversalProc((userRoutine), uppWELineBreakProcInfo, (pText), (textLength), (textStart), (textEnd), (textWidth), (textOffset), (hWE))
  955. #define CallWEWordBreakProc(pText, textLength, offset, edge, breakOffsets, script, hWE, userRoutine) \
  956.     CallUniversalProc((userRoutine), uppWEWordBreakProcInfo, (pText), (textLength), (offset), (edge), (breakOffsets), (script), (hWE))
  957. #define CallWECharByteProc(pText, textOffset, script, hWE, userRoutine) \
  958.     CallUniversalProc((userRoutine), uppWECharByteProcInfo, (pText), (textOffset), (script), (hWE))
  959. #define CallWECharTypeProc(pText, textOffset, script, hWE, userRoutine) \
  960.     CallUniversalProc((userRoutine), uppWECharTypeProcInfo, (pText), (textOffset), (script), (hWE))
  961. #define CallWEEraseProc(area, hWE, userRoutine) \
  962.     CallUniversalProc((userRoutine), uppWEEraseProcInfo, (area), (hWE))
  963. #define CallWEFluxProc(offset, delta, hWE, userRoutine) \
  964.     CallUniversalProc((userRoutine), uppWEFluxProcInfo, (offset), (delta), (hWE))
  965. #define CallWENewObjectProc(defaultObjectSize, hObjectDesc, userRoutine) \
  966.     CallUniversalProc((userRoutine), uppWENewObjectProcInfo, (defaultObjectSize), (hObjectDesc))
  967. #define CallWEDisposeObjectProc(hObjectDesc, userRoutine) \
  968.     CallUniversalProc((userRoutine), uppWEDisposeObjectProcInfo, (hObjectDesc))
  969. #define CallWEDrawObjectProc(destRect, hObjectDesc, userRoutine) \
  970.     CallUniversalProc((userRoutine), uppWEDrawObjectProcInfo, (destRect), (hObjectDesc))
  971. #define CallWEClickObjectProc(hitPt, modifiers, clickTime, hObjectDesc, userRoutine) \
  972.     CallUniversalProc((userRoutine), uppWEClickObjectProcInfo, (hitPt), (modifiers), (clickTime), (hObjectDesc))
  973. #define CallWEStreamObjectProc(destKind, theType, putDataHere, hObjectDesc, userRoutine) \
  974.     CallUniversalProc((userRoutine), uppWEStreamObjectProcInfo, (destKind), (theType), (putDataHere), (hObjectDesc))
  975.  
  976. #else
  977.  
  978. typedef WEClickLoopProcPtr WEClickLoopUPP;
  979. typedef WEScrollProcPtr WEScrollUPP;
  980. typedef WETSMPreUpdateProcPtr WETSMPreUpdateUPP;
  981. typedef WETSMPostUpdateProcPtr WETSMPostUpdateUPP;
  982. typedef WEPreTrackDragProcPtr WEPreTrackDragUPP;
  983. typedef WETranslateDragProcPtr WETranslateDragUPP;
  984. typedef WEHiliteDropAreaProcPtr WEHiliteDropAreaUPP;
  985. typedef WEFontIDToNameProcPtr WEFontIDToNameUPP;
  986. typedef WEFontNameToIDProcPtr WEFontNameToIDUPP;
  987. typedef WEDrawTextProcPtr WEDrawTextUPP;
  988. typedef WEPixelToCharProcPtr WEPixelToCharUPP;
  989. typedef WECharToPixelProcPtr WECharToPixelUPP;
  990. typedef WELineBreakProcPtr WELineBreakUPP;
  991. typedef WEWordBreakProcPtr WEWordBreakUPP;
  992. typedef WECharByteProcPtr WECharByteUPP;
  993. typedef WECharTypeProcPtr WECharTypeUPP;
  994. typedef WEEraseProcPtr WEEraseUPP;
  995. typedef WEFluxProcPtr WEFluxUPP;
  996. typedef WENewObjectProcPtr WENewObjectUPP;
  997. typedef WEDisposeObjectProcPtr WEDisposeObjectUPP;
  998. typedef WEDrawObjectProcPtr WEDrawObjectUPP;
  999. typedef WEClickObjectProcPtr WEClickObjectUPP;
  1000. typedef WEStreamObjectProcPtr WEStreamObjectUPP;
  1001.  
  1002. #define NewWEClickLoopProc(userRoutine) ((WEClickLoopUPP) (userRoutine))
  1003. #define NewWEScrollProc(userRoutine) ((WEScrollUPP) (userRoutine))
  1004. #define NewWETSMPreUpdateProc(userRoutine) ((WETSMPreUpdateUPP) (userRoutine))
  1005. #define NewWETSMPostUpdateProc(userRoutine) ((WETSMPostUpdateUPP) (userRoutine))
  1006. #define NewWEPreTrackDragProc(userRoutine) ((WEPreTrackDragUPP) (userRoutine))
  1007. #define NewWETranslateDragProc(userRoutine) ((WETranslateDragUPP) (userRoutine))
  1008. #define NewWEHiliteDropAreaProc(userRoutine) ((WEHiliteDropAreaUPP) (userRoutine))
  1009. #define NewWEFontIDToNameProc(userRoutine) ((WEFontIDToNameUPP) (userRoutine))
  1010. #define NewWEFontNameToIDProc(userRoutine) ((WEFontNameToIDUPP) (userRoutine))
  1011. #define NewWEDrawTextProc(userRoutine) ((WEDrawTextUPP) (userRoutine))
  1012. #define NewWEPixelToCharProc(userRoutine) ((WEPixelToCharUPP) (userRoutine))
  1013. #define NewWECharToPixelProc(userRoutine) ((WECharToPixelUPP) (userRoutine))
  1014. #define NewWELineBreakProc(userRoutine) ((WELineBreakUPP) (userRoutine))
  1015. #define NewWEWordBreakProc(userRoutine) ((WEWordBreakUPP) (userRoutine))
  1016. #define NewWECharByteProc(userRoutine) ((WECharByteUPP) (userRoutine))
  1017. #define NewWECharTypeProc(userRoutine) ((WECharTypeUPP) (userRoutine))
  1018. #define NewWEEraseProc(userRoutine) ((WEEraseUPP) (userRoutine))
  1019. #define NewWEFluxProc(userRoutine) ((WEFluxUPP) (userRoutine))
  1020. #define NewWENewObjectProc(userRoutine) ((WENewObjectUPP) (userRoutine))
  1021. #define NewWEDisposeObjectProc(userRoutine) ((WEDisposeObjectUPP) (userRoutine))
  1022. #define NewWEDrawObjectProc(userRoutine) ((WEDrawObjectUPP) (userRoutine))
  1023. #define NewWEClickObjectProc(userRoutine) ((WEClickObjectUPP) (userRoutine))
  1024. #define NewWEStreamObjectProc(userRoutine) ((WEStreamObjectUPP) (userRoutine))
  1025.  
  1026. #define CallWEClickLoopProc(hWE, userRoutine) \
  1027.     (*(userRoutine))((hWE))
  1028. #define CallWEScrollProc(hWE, userRoutine) \
  1029.     (*(userRoutine))((hWE))
  1030. #define CallWETSMPreUpdateProc(hWE, userRoutine) \
  1031.     (*(userRoutine))((hWE))
  1032. #define CallWETSMPostUpdateProc(hWE, fixLength, inputAreaStart, inputAreaEnd, pinRangeStart, pinRangeEnd, userRoutine) \
  1033.     (*(userRoutine))((hWE), (fixLength), (inputAreaStart), (inputAreaEnd), (pinRangeStart), (pinRangeEnd))
  1034. #define CallWEPreTrackDragProc(drag, hWE, userRoutine) \
  1035.     (*(userRoutine))((drag), (hWE))
  1036. #define CallWETranslateDragProc(drag, dragItem, requestedType, putDataHere, dropOffset, hWE, userRoutine) \
  1037.     (*(userRoutine))((drag), (dragItem), (requestedType), (putDataHere), (dropOffset), (hWE))
  1038. #define CallWEHiliteDropAreaProc(drag, hiliteFlag, hWE, userRoutine) \
  1039.     (*(userRoutine))((drag), (hiliteFlag), (hWE))
  1040. #define CallWEFontIDToNameProc(fontID, fontName, userRoutine) \
  1041.     (*(userRoutine))((fontID), (fontName))
  1042. #define CallWEFontNameToIDProc(fontName, oldFontID, fontID, userRoutine) \
  1043.     (*(userRoutine))((fontName), (oldFontID), (fontID))
  1044. #define CallWEDrawTextProc(pText, textLength, slop, styleRunPosition, hWE, userRoutine) \
  1045.     (*(userRoutine))((pText), (textLength), (slop), (styleRunPosition), (hWE))
  1046. #define CallWEPixelToCharProc(pText, textLength, slop, pixelWidth, edge, styleRunPosition, hPos, hWE, userRoutine) \
  1047.     (*(userRoutine))((pText), (textLength), (slop), (pixelWidth), (edge), (styleRunPosition), (hPos), (hWE))
  1048. #define CallWECharToPixelProc(pText, textLength, slop, offset, direction, styleRunPosition, hPos, hWE, userRoutine) \
  1049.     (*(userRoutine))((pText), (textLength), (slop), (offset), (direction), (styleRunPosition), (hPos), (hWE))
  1050. #define CallWELineBreakProc(pText, textLength, textStart, textEnd, textWidth, textOffset, hWE, userRoutine) \
  1051.     (*(userRoutine))((pText), (textLength), (textStart), (textEnd), (textWidth), (textOffset), (hWE))
  1052. #define CallWEWordBreakProc(pText, textLength, offset, edge, breakOffsets, script, hWE, userRoutine) \
  1053.     (*(userRoutine))((pText), (textLength), (offset), (edge), (breakOffsets), (script), (hWE))
  1054. #define CallWECharByteProc(pText, textOffset, script, hWE, userRoutine) \
  1055.     (*(userRoutine))((pText), (textOffset), (script), (hWE))
  1056. #define CallWECharTypeProc(pText, textOffset, script, hWE, userRoutine) \
  1057.     (*(userRoutine))((pText), (textOffset), (script), (hWE))
  1058. #define CallWEEraseProc(area, hWE, userRoutine) \
  1059.     (*(userRoutine))((area), (hWE))
  1060. #define CallWEFluxProc(offset, delta, hWE, userRoutine) \
  1061.     (*(userRoutine))((offset), (delta), (hWE))
  1062. #define CallWENewObjectProc(defaultObjectSize, hObjectDesc, userRoutine) \
  1063.     (*(userRoutine))((defaultObjectSize), (hObjectDesc))
  1064. #define CallWEDisposeObjectProc(hObjectDesc, userRoutine) \
  1065.     (*(userRoutine))((hObjectDesc))
  1066. #define CallWEDrawObjectProc(destRect, hObjectDesc, userRoutine) \
  1067.     (*(userRoutine))((destRect), (hObjectDesc))
  1068. #define CallWEClickObjectProc(hitPt, modifiers, clickTime, hObjectDesc, userRoutine) \
  1069.     (*(userRoutine))((hitPt), (modifiers), (clickTime), (hObjectDesc))
  1070. #define CallWEStreamObjectProc(destKind, theType, putDataHere, hObjectDesc, userRoutine) \
  1071.     (*(userRoutine))((destKind), (theType), (putDataHere), (hObjectDesc))
  1072.  
  1073. #endif
  1074.  
  1075. typedef Boolean (*WESegmentLoopProcPtr)
  1076.     (
  1077.         WELineRec *pLine,
  1078.         const WERunAttributes *pAttrs,
  1079.         Ptr pSegment,
  1080.         SInt32 segmentStart,
  1081.         SInt32 segmentLength,
  1082.         JustStyleCode styleRunPosition,
  1083.         WEHandle hWE,
  1084.         void *callbackData
  1085.     );
  1086.  
  1087. typedef FourCharCode WESelector;
  1088.  
  1089. typedef struct WEFieldDescriptor
  1090. {
  1091.     SInt16 fOffset;
  1092.     SInt16 fLength;
  1093. } WEFieldDescriptor;
  1094.  
  1095. typedef struct WELookupTable
  1096. {
  1097.     WESelector selector;
  1098.     WEFieldDescriptor desc;
  1099. } WELookupTable;
  1100.  
  1101. typedef struct WEUserInfoEntry
  1102. {
  1103.     WESelector tag;
  1104.     SInt32 info;
  1105. } WEUserInfoEntry;
  1106.  
  1107. typedef struct WEOHTableEntry
  1108. {
  1109.     FlavorType objectType;
  1110.     WENewObjectUPP newHandler;
  1111.     WEDisposeObjectUPP freeHandler;
  1112.     WEDrawObjectUPP drawHandler;
  1113.     WEClickObjectUPP clickHandler;
  1114.     WEStreamObjectUPP streamHandler;
  1115.     SInt32 refCon;
  1116. } WEOHTableEntry, **WEOHTableHandle;
  1117.  
  1118. typedef struct WEObjectDesc
  1119. {
  1120.     FlavorType objectType;                // 4-letter tag identifying object type
  1121.     Handle objectDataHandle;            // handle to object data
  1122.     Point objectSize;                    // object height and width, in pixels
  1123.     WEOHTableHandle objectTable;        // handle to object handler table
  1124.     SInt32 objectIndex;                    // index into object handler table
  1125.     WEHandle objectOwner;                // handle to owner WE instance
  1126.     SInt32 objectRefCon;                // free for use by object handlers
  1127. } WEObjectDesc;
  1128.  
  1129. typedef struct WERec
  1130. {
  1131.     GrafPtr port;                            // graphics port text is drawn into
  1132.     Handle hText;                            // handle to the text
  1133.     WELineArrayHandle hLines;                // handle to the line array
  1134.     WEStyleTableHandle hStyles;                // handle to the style table
  1135.     WERunArrayHandle hRuns;                    // handle to the style run array
  1136.     SInt32 textLength;                        // length of text
  1137.     SInt32 nLines;                            // number of lines
  1138.     SInt32 nStyles;                            // number of unique styles in the style table
  1139.     SInt32 nRuns;                            // number of style runs
  1140.     LongRect viewRect;                        // view rectangle, all drawing is clipped to this
  1141.     LongRect destRect;                        // destination rectangle
  1142.     SInt32 selStart;                        // start of selection range
  1143.     SInt32 selEnd;                            // end of selection range
  1144.     UInt32 flags;                            // 32 bits of miscellaneous flags (private)
  1145.     UInt32 features;                        // 32 bit of feature flags (public)
  1146.     UInt32 caretTime;                        // time of most recent caret drawing, in ticks
  1147.     UInt32 clickTime;                        // time of most recent click, in ticks
  1148.     SInt32 clickLoc;                        // byte offset of most recent click
  1149.     SInt32 anchorStart;                        // start offset of anchor word/line
  1150.     SInt32 anchorEnd;                        // end offset of anchor word/line
  1151.     char firstByte;                            // first byte of a double-byte character
  1152.     WEEdge clickEdge;                        // edge of character hit by most recent click
  1153.     UInt8 clickCount;                        // multiple click count
  1154.     WEAlignment alignment;                    // alignment style
  1155.     WEDirection direction;                    // dominant line direction
  1156.     SInt16 filler1;                            // unused
  1157.     GrafPtr offscreenPort;                    // offscreen graphics world
  1158.     RgnHandle viewRgn;                        // handle to the view region
  1159.     void *refCon;                            // reference value for client use
  1160.     Handle hUserInfo;                        // more junk for client use
  1161.     TSMDocumentID tsmReference;                // reference value for the text services manager
  1162.     SInt32 tsmAreaStart;                    // start of active input area (for TSM)
  1163.     SInt32 tsmAreaEnd;                        // end of active input area
  1164.     DragReference currentDrag;                // reference of drag being tracked by _WEDrag
  1165.     SInt32 dragCaretOffset;                    // offset to caret displayed during a drag
  1166.     WEActionHandle hActionStack;            // action stack for undo
  1167.     UInt32 modCount;                        // modification count
  1168.     WEClickLoopUPP clickLoop;                // click loop callback
  1169.     WEScrollUPP scrollProc;                    // scroll callback
  1170.     WETSMPreUpdateUPP tsmPreUpdate;            // TSM pre-update callback
  1171.     WETSMPostUpdateUPP tsmPostUpdate;        // TSM post-update callback
  1172.     WEPreTrackDragUPP preTrackDragHook;        // pre-TrackDrag hook
  1173.     WETranslateDragUPP translateDragHook;    // drag translation hook
  1174.     WEHiliteDropAreaUPP hiliteDropAreaHook;    // drop area highlighting hook
  1175.     WEDrawTextUPP drawTextHook;                // hook for drawing text
  1176.     WEPixelToCharUPP pixelToCharHook;        // hook for hit-testing
  1177.     WECharToPixelUPP charToPixelHook;        // hook for locating glyph position
  1178.     WELineBreakUPP lineBreakHook;            // hook for finding line breaks
  1179.     WEWordBreakUPP wordBreakHook;            // hook for finding word breaks
  1180.     WECharByteUPP charByteHook;                // hook for finding character byte type
  1181.     WECharTypeUPP charTypeHook;                // hook for finding character type
  1182.     WEEraseUPP eraseHook;                    // hook for erasing background
  1183.     WEFluxUPP fluxProc;                        // flux callback
  1184.     WERunAttributes nullStyle;                // style for null selection
  1185.     WEOHTableHandle hObjectHandlerTable;    // handle to object handler table for this instance
  1186.     SInt32 translucencyThreshold;            // use translucent drags unless selection area exceeds this
  1187.     StringHandle hURLHint;                    // hint string for slack URLs
  1188. } WERec;
  1189.  
  1190. struct SLDrawData
  1191. {
  1192.     GrafPtr screenPort;
  1193.     GDHandle screenDevice;
  1194.     PixMapHandle offscreenPixels;    // offscreen pixel map
  1195.     Rect bounds;                    // bounds of offscreen buffer, in global coords
  1196.     Rect lineRect;                    // rect enclosing current line
  1197.     Rect drawRect;                    // visible portion of line rect
  1198.     Boolean usingColor;                // true if drawing in color
  1199.     Boolean usingOffscreen;            // true if an offscreen graphics world has been set up
  1200.     Boolean drawingOffscreen;        // true if actually drawing to an offscreen buffer
  1201.     Boolean doErase;                // true if line rectangle should be erased before drawing
  1202. };
  1203.  
  1204. struct SLCalcSlopData
  1205. {
  1206.     SInt16 lineWidth;
  1207.     SInt16 totalSlop;
  1208.     Fixed totalProportion;
  1209. };
  1210.  
  1211. struct SLPixelToCharData
  1212. {
  1213.     Fixed hPos;
  1214.     Fixed pixelWidth;
  1215.     SInt32 offset;
  1216.     WEEdge edge;
  1217. };
  1218.  
  1219. struct SLCharToPixelData
  1220. {
  1221.     LongPt *thePoint;
  1222.     SInt32 offset;
  1223.     SInt16 direction;
  1224.     Boolean lineDir;    // is the line direction RL?
  1225.     Boolean rightEdge;    // are we getting the right edge of the line?
  1226. };
  1227.  
  1228. struct SLCollectHiliteRgnData
  1229. {
  1230.     SInt32 rangeStart;
  1231.     SInt32 rangeEnd;
  1232.     SInt16 hPos;
  1233. };
  1234.  
  1235. struct SLCrossDirectionBoundaryData
  1236. {
  1237.     SInt32 oldOffset;        //    offset before crossing direction boundary
  1238.     SInt32 newOffset;        //    offset after crossing direction boundary
  1239.     Boolean movingRight;    //    moving insertion point to the right?
  1240.     Boolean isDone;
  1241. };
  1242.  
  1243. struct FormatOrderData
  1244. {
  1245.     SInt32 firstRun;
  1246.     WEHandle hWE;
  1247. };
  1248.  
  1249. #if PRAGMA_ALIGN_SUPPORTED
  1250. #pragma options align=reset
  1251. #endif
  1252.  
  1253. #ifdef __cplusplus
  1254. extern "C" {
  1255. #endif
  1256.  
  1257. //    PUBLIC ROUTINES
  1258.  
  1259. //    WEAccessors.c (public)
  1260. pascal SInt32 WEOffsetToLine(SInt32 offset, WEHandle hWE);
  1261. pascal SInt32 WECountLines(WEHandle hWE);
  1262. pascal void WEGetLineRange(SInt32 lineIndex, SInt32 *lineStart, SInt32 *lineEnd, WEHandle hWE);
  1263. pascal SInt32 WEOffsetToRun (SInt32 offset, WEHandle hWE);
  1264. pascal SInt32 WECountRuns(WEHandle hWE);
  1265. pascal void WEGetRunRange(SInt32 runIndex, SInt32 *runStart, SInt32 *runEnd, WEHandle hWE);
  1266. pascal Boolean WEGetRunDirection(SInt32 offset, WEHandle hWE);
  1267. pascal void WEGetRunInfo(SInt32 offset, WERunInfo *info, WEHandle hWE);
  1268. pascal void WESetDestRect(const LongRect *destRect, WEHandle hWE);
  1269. pascal void WEGetDestRect(LongRect *destRect, WEHandle hWE);
  1270. pascal void WESetViewRect(const LongRect *viewRect, WEHandle hWE);
  1271. pascal void WEGetViewRect(LongRect *viewRect, WEHandle hWE);
  1272. pascal WEAlignment WEGetAlignment(WEHandle hWE);
  1273. pascal WEDirection WEGetDirection(WEHandle hWE);
  1274. pascal void WEGetSelection(SInt32 *selStart, SInt32 *selEnd, WEHandle hWE);
  1275. pascal SInt32 WEGetTextLength(WEHandle hWE);
  1276. pascal SInt32 WEGetHeight(SInt32 startLine, SInt32 endLine, WEHandle hWE);
  1277. pascal Handle WEGetText(WEHandle hWE);
  1278. pascal SInt16 WEGetChar(SInt32 offset, WEHandle hWE);
  1279. pascal SInt16 WEFeatureFlag(SInt16 feature, SInt16 action, WEHandle hWE);
  1280. pascal UInt32 WEVersion(void);
  1281.  
  1282. //    WEBirthDeath.c (public)
  1283. pascal OSErr WENew(const LongRect *destRect, const LongRect *viewRect, UInt32 features, WEHandle *hWE);
  1284. pascal void WEDispose(WEHandle hWE);
  1285. pascal OSErr WEUseText(Handle text, WEHandle hWE);
  1286.  
  1287. //    WEDrawing.c (public)
  1288. pascal OSErr WEGetSelectedObject(WEObjectDescHandle *hObjectDesc, WEHandle hWE);
  1289. pascal SInt32 WEFindNextObject(SInt32 offset, WEObjectDescHandle *hObjectDesc, WEHandle hWE);
  1290. pascal Boolean WEContinuousStyle(WEStyleMode *mode, TextStyle *ts, WEHandle hWE);
  1291.  
  1292. //    WEFontTables.c (public)
  1293. pascal OSErr WEBuildFontTable(Handle hFontTable, WEFontIDToNameUPP fontIDToNameProc, WEHandle hWE);
  1294. pascal OSErr WEUpdateFontTable(Handle hFontTable, WEFontNameToIDUPP fontNameToIDProc, Boolean *wasChanged);
  1295. pascal OSErr WEUpdateStyleScrap(StScrpHandle hStyles, Handle hFontTable);
  1296.  
  1297. //    WEHighLevelEditing.c (public)
  1298. pascal OSErr WEUndo(WEHandle hWE);
  1299. pascal void WEClearUndo(WEHandle hWE);
  1300. pascal WEActionKind WEGetUndoInfo(Boolean *redoFlag, WEHandle hWE);
  1301. pascal OSErr WEBeginAction(WEHandle hWE);
  1302. pascal OSErr WEEndAction(WEActionKind actionKind, WEHandle hWE);
  1303. pascal UInt32 WEGetModCount(WEHandle hWE);
  1304. pascal void WEResetModCount(WEHandle hWE);
  1305. pascal Boolean WEIsTyping(WEHandle hWE);
  1306. pascal void WEKey(SInt16 key, EventModifiers modifiers, WEHandle hWE);
  1307. pascal OSErr WEInsert(Ptr textPtr, SInt32 textLength, StScrpHandle hStyles, Handle hSoup, WEHandle hWE);
  1308. pascal OSErr WEInsertObject(FlavorType objectType, Handle objectDataHandle, Point objectSize, WEHandle hWE);
  1309. pascal OSErr WEDelete(WEHandle hWE);
  1310. pascal OSErr WECut(WEHandle hWE);
  1311. pascal Boolean WECanPaste(WEHandle hWE);
  1312. pascal OSErr WEPaste(WEHandle hWE);
  1313. pascal OSErr WESetStyle(WEStyleMode mode, const TextStyle *ts, WEHandle hWE);
  1314. pascal OSErr WEUseStyleScrap(StScrpHandle hStyles, WEHandle hWE);
  1315. pascal OSErr WEUseSoup(Handle hSoup, WEHandle hWE);
  1316.  
  1317. //    WEInlineInput.c (public)
  1318. pascal OSErr WEInstallTSMHandlers(void);
  1319. pascal OSErr WERemoveTSMHandlers(void);
  1320. pascal OSErr WEHandleTSMEvent(const AppleEvent *ae, AppleEvent *reply);
  1321. pascal void WEStopInlineSession(WEHandle hWE);
  1322.  
  1323. //    WELineLayout (public)
  1324. pascal OSErr WECalText(WEHandle hWE);
  1325. pascal void WESetAlignment(WEAlignment alignment, WEHandle hWE);
  1326. pascal void WESetDirection(WEDirection direction, WEHandle hWE);
  1327.  
  1328. //    WELongCoords.c (public)
  1329. pascal void WELongPointToPoint(const LongPt *lp, Point *p);
  1330. pascal void WEPointToLongPoint(Point p, LongPt *lp);
  1331. pascal void WESetLongRect(LongRect *lr, SInt32 left, SInt32 top, SInt32 right, SInt32 bottom);
  1332. pascal void WELongRectToRect(const LongRect *lr, Rect *r);
  1333. pascal void WERectToLongRect(const Rect *r, LongRect *lr);
  1334. pascal void WEOffsetLongRect(LongRect *lr, SInt32 hOffset, SInt32 vOffset);
  1335. pascal Boolean WELongPointInLongRect(const LongPt *lp, const LongRect *lr);
  1336.  
  1337. //    WEMouse.c (public)
  1338. pascal Boolean WECanAcceptDrag(DragReference drag, WEHandle hWE);
  1339. pascal OSErr WETrackDrag(DragTrackingMessage message, DragReference drag,
  1340.                                     WEHandle hWE);
  1341. pascal OSErr WEReceiveDrag(DragReference drag, WEHandle hWE);
  1342. pascal Boolean WEDraggedToTrash(DragReference drag);
  1343. pascal void WEClick(Point mouseLoc, EventModifiers modifiers, UInt32 clickTime, WEHandle hWE);
  1344. pascal UInt16 WEGetClickCount(WEHandle hWE);
  1345.  
  1346. //    WEObjects.c (public)
  1347. pascal FlavorType WEGetObjectType(WEObjectDescHandle hObjectDesc);
  1348. pascal Handle WEGetObjectDataHandle(WEObjectDescHandle hObjectDesc);
  1349. pascal Point WEGetObjectSize(WEObjectDescHandle hObjectDesc);
  1350. pascal WEHandle WEGetObjectOwner(WEObjectDescHandle hObjectDesc);
  1351. pascal SInt32 WEGetObjectRefCon(WEObjectDescHandle hObjectDesc);
  1352. pascal void WESetObjectRefCon(WEObjectDescHandle hObjectDesc, SInt32 refCon);
  1353. pascal OSErr WEInstallObjectHandler(FlavorType objectType, WESelector handlerSelector,
  1354.                 UniversalProcPtr handler, WEHandle hWE);
  1355. pascal OSErr WEGetObjectHandler(FlavorType objectType, WESelector handlerSelector,
  1356.                 UniversalProcPtr *handler, WEHandle hWE);
  1357.  
  1358. //    WEScraps.c (public)
  1359. pascal OSErr WECopyRange(SInt32 rangeStart, SInt32 rangeEnd, Handle hText, Handle
  1360.                     hStyles, Handle hSoup, WEHandle hWE);
  1361. pascal OSErr WECopy(WEHandle hWE);
  1362.  
  1363. //    WESelecting.c (public)
  1364. pascal SInt32 WEGetOffset(const LongPt *thePoint, WEEdge *edge, WEHandle hWE);
  1365. pascal void WEGetPoint(SInt32 offset, SInt16 direction, LongPt *thePoint, SInt16 *lineHeight, WEHandle hWE);
  1366. pascal void WEFindWord(SInt32 offset, WEEdge edge, SInt32 *wordStart, SInt32 *wordEnd, WEHandle hWE);
  1367. pascal void WEFindLine(SInt32 offset, WEEdge edge, SInt32 *lineStart, SInt32 *lineEnd, WEHandle hWE);
  1368. pascal void WEFindParagraph(SInt32 offset, WEEdge edge, SInt32 *paragraphStart, SInt32 *paragraphEnd, WEHandle hWE);
  1369. pascal SInt16 WECharByte(SInt32 offset, WEHandle hWE);
  1370. pascal SInt16 WECharType(SInt32 offset, WEHandle hWE);
  1371. pascal RgnHandle WEGetHiliteRgn(SInt32 rangeStart, SInt32 rangeEnd, WEHandle hWE);
  1372. pascal void WESetSelection(SInt32 selStart, SInt32 selEnd, WEHandle hWE);
  1373. pascal Boolean WEAdjustCursor(Point mouseLoc, RgnHandle mouseRgn, WEHandle hWE);
  1374. pascal void WEIdle(UInt32 *maxSleep, WEHandle hWE);
  1375. pascal void WEUpdate(RgnHandle updateRgn, WEHandle hWE);
  1376. pascal void WEDeactivate(WEHandle hWE);
  1377. pascal void WEActivate(WEHandle hWE);
  1378. pascal Boolean WEIsActive(WEHandle hWE);
  1379. pascal void WEScroll(SInt32 hOffset, SInt32 vOffset, WEHandle hWE);
  1380. pascal void WEPinScroll(SInt32 hOffset, SInt32 vOffset, WEHandle hWE);
  1381. pascal void WESelView(WEHandle hWE);
  1382.  
  1383. //    WESelectors.c (public)
  1384. pascal OSErr WEGetInfo(WESelector selector, void *info, WEHandle hWE);
  1385. pascal OSErr WESetInfo(WESelector selector, const void *info, WEHandle hWE);
  1386.  
  1387. //    WEUserSelectors.c (public)
  1388. pascal OSErr WEGetUserInfo(WESelector tag, SInt32 *userInfo, WEHandle hWE);
  1389. pascal OSErr WESetUserInfo(WESelector tag, SInt32 userInfo, WEHandle hWE);
  1390.  
  1391. //    WESharedLibrary.c
  1392. pascal OSErr _WECFMInitialize(const CFragInitBlock *theInitBlock);
  1393. pascal void _WECFMTerminate(void);
  1394.  
  1395.  
  1396. //    PRIVATE ROUTINES
  1397.  
  1398. //    These routines should be eligible to be tagged "internal" when
  1399. //    building a CFM shared library: they should never be exported
  1400. //    (listed in the .exp file) and their address should never be passed
  1401. //    to an external fragment.
  1402.  
  1403. #if WASTE_SHARED_LIBRARY
  1404. #pragma internal on
  1405. #endif
  1406.  
  1407. //    WEAccessors.c (private)
  1408. pascal SInt32 _WEPixelToLine(SInt32 vOffset, WEHandle hWE);
  1409. pascal void _WEGetIndStyle(SInt32 runIndex, WERunInfo *info, WEHandle hWE);
  1410. pascal Boolean _WEGetIndDirection(SInt32 runIndex, WEHandle hWE);
  1411.  
  1412. //    WEBirthDeath.c (private)
  1413. extern const Point kOneToOneScaling;
  1414. pascal void _WEResetStyleTable(WEHandle hWE);
  1415. pascal OSErr _WERegisterWithTSM(WEHandle hWE);
  1416. pascal void _WESetStandardHooks(WEHandle hWE);
  1417. pascal SInt16 _WEScriptToFont(ScriptCode script);
  1418.  
  1419. //    WEDebug.c (private)
  1420. pascal void _WESanityCheck(WEHandle hWE);
  1421.  
  1422. //    WEDrawing.c (private)
  1423. pascal void _WEContinuousStyleRange(SInt32 rangeStart, SInt32 rangeEnd,
  1424.         WEStyleMode *mode, WETextStyle *ts, WEHandle hWE);
  1425. pascal void _WESynchNullStyle(WEHandle hWE);
  1426. pascal void _WESegmentLoop(SInt32 firstLine, SInt32 lastLine, WESegmentLoopProcPtr callback, void *callbackData, WEHandle hWE);
  1427. pascal void _WEDrawTSMHilite(Rect *segmentRect, UInt8 tsFlags);
  1428. pascal void _WEDrawLines (SInt32 firstLine, SInt32 lastLine, Boolean doErase, WEHandle hWE);
  1429. pascal SInt16 _WECalcPenIndent(const WELineRec * pLine, WEAlignment alignment, WEDirection direction);
  1430. pascal void _WESaveQDEnvironment(GrafPtr port, Boolean saveColor, QDEnvironment *environment);
  1431. pascal void _WERestoreQDEnvironment(const QDEnvironment *environment);
  1432. pascal void _WEFillFontInfo (GrafPtr port, WERunAttributes *targetStyle);
  1433. pascal void _WECopyStyle (const WETextStyle *sourceStyle, WETextStyle *targetStyle,
  1434.         Style offStyles, WEStyleMode mode);
  1435. pascal Boolean _WEOffsetInRange(SInt32 offset, WEEdge edge, SInt32 rangeStart, SInt32 rangeEnd);
  1436.  
  1437. //    WEHighLevelEditing.c (private)
  1438. pascal void _WEPushAction(WEActionHandle hAction);
  1439. pascal OSErr _WENewAction(SInt32 rangeStart, SInt32 rangeEnd, SInt32 newTextLength,
  1440.                             WEActionKind actionKind, WEActionFlags actionFlags,
  1441.                             WEHandle hWE, WEActionHandle *hAction);
  1442. pascal void _WEDisposeAction(WEActionHandle hAction);
  1443. pascal void _WEForgetAction(WEActionHandle *hAction);
  1444. pascal OSErr _WEDoAction(WEActionHandle hAction);
  1445. pascal void _WEAdjustUndoRange(SInt32 moreBytes, WEHandle hWE);
  1446. pascal OSErr _WETypeChar(char theByte, WEHandle hWE);
  1447. pascal OSErr _WEBackspace(WEHandle hWE);
  1448. pascal OSErr _WEForwardDelete(WEHandle hWE);
  1449. pascal OSErr _WEGetScrapHandle(FlavorType dataFlavor, Handle *dataHandle);
  1450. pascal OSErr _WESmartSetFont(WEStyleMode mode, const TextStyle *ts, WEHandle hWE);
  1451.  
  1452. //    WEInlineInput.c (private)
  1453. pascal OSErr _WEHiliteRangeArray(TextRangeArrayHandle hTray, WEHandle hWE);
  1454.  
  1455. //    WELineLayout.c (private)
  1456. INLINE pascal void _WERemoveLine(SInt32 lineIndex, WEPtr pWE); // Motorola 12-Nov-97
  1457. pascal OSErr _WEInsertLine(SInt32 lineIndex, const WELineRec *pLine, WEPtr pWE);
  1458. pascal void _WEBumpOrigin(SInt32 lineIndex, SInt32 deltaOrigin, WEPtr pWE);
  1459. pascal SInt32 _WEFindLineBreak(SInt32 lineStart, WEHandle hWE);
  1460. pascal void _WECalcHeights(SInt32 rangeStart, SInt32 rangeEnd, SInt16 *lineAscent, SInt16 *lineDescent,
  1461.         WEHandle hWE);
  1462. pascal OSErr _WERecalBreaks(SInt32 *startLine, SInt32 *endLine, WEHandle hWE);
  1463. pascal void _WERecalSlops(SInt32 firstLine, SInt32 lastLine, WEHandle hWE);
  1464.  
  1465. //    WELowLevelEditing.c (private)
  1466. pascal Boolean _WEIsWordRange(SInt32 rangeStart, SInt32 rangeEnd, WEHandle hWE);
  1467. pascal Boolean _WEIsPunct(SInt32 offset, WEHandle hWE);
  1468. pascal void _WEIntelligentCut(SInt32 *rangeStart, SInt32 *rangeEnd, WEHandle hWE);
  1469. pascal SInt16 _WEIntelligentPaste(SInt32 rangeStart, SInt32 rangeEnd, WEHandle hWE);
  1470. pascal OSErr _WEInsertRun(SInt32 runIndex, SInt32 offset, SInt32 styleIndex, WEPtr pWE);
  1471. pascal void _WERemoveRun(SInt32 runIndex, WEPtr pWE);
  1472. pascal void _WEChangeRun(SInt32 runIndex, SInt32 newStyleIndex, Boolean keepOld, WEPtr pWE);
  1473. pascal OSErr _WENewStyle(const WETextStyle *ts, SInt32 *styleIndex, WEPtr pWE);
  1474. pascal OSErr _WERedraw(SInt32 rangeStart, SInt32 rangeEnd, WEHandle hWE);
  1475. pascal OSErr _WESetStyleRange(SInt32 rangeStart, SInt32 rangeEnd, WEStyleMode mode,
  1476.                 const WETextStyle *ts, WEHandle hWE);
  1477. pascal OSErr _WEApplyStyleScrap(SInt32 rangeStart, SInt32 rangeEnd, StScrpHandle styleScrap, WEHandle hWE);
  1478. pascal OSErr _WEApplySoup(SInt32 offset, Handle hSoup, WEHandle hWE);
  1479. pascal void _WEBumpRunStart(SInt32 runIndex, SInt32 deltaRunStart, WEPtr pWE);
  1480. pascal void _WERemoveRunRange(SInt32 rangeStart, SInt32 rangeEnd, WEHandle hWE);
  1481. pascal void _WEBumpLineStart(SInt32 lineIndex, SInt32 deltaLineStart, WEPtr pWE);
  1482. pascal void _WERemoveLineRange(SInt32 rangeStart, SInt32 rangeEnd, WEHandle hWE);
  1483. pascal OSErr _WEDeleteRange(SInt32 rangeStart, SInt32 rangeEnd, WEHandle hWE);
  1484. pascal OSErr _WEInsertText(SInt32 offset, Ptr textPtr, SInt32 textLength, WEHandle hWE);
  1485.  
  1486. //    WELongCoords (private)
  1487. pascal SInt32 _WEPinInRange(SInt32 value, SInt32 rangeStart, SInt32 rangeEnd);
  1488.  
  1489. //    WEMouse.c (private)
  1490. pascal Boolean _WEIsOptionDrag(DragReference drag);
  1491. pascal OSErr _WEGetFlavor(DragReference drag, ItemReference dragItem,
  1492.                 FlavorType requestedType, Handle hFlavor,
  1493.                 SInt32 dropOffset, WEHandle hWE);
  1494. pascal OSErr _WEExtractFlavor(DragReference drag, ItemReference dragItem,
  1495.                         FlavorType theType, Handle *hFlavor,
  1496.                         SInt32 dropOffset, WEHandle hWE);
  1497. pascal void _WEUpdateDragCaret(SInt32 offset, WEHandle hWE);
  1498. pascal RgnHandle _WEOutlineRgn(RgnHandle solidRgn);
  1499. pascal OSErr _WEMakeDragImage(GWorldPtr *imageGWorld, RgnHandle *imageRgn, WEHandle hWE);
  1500. pascal OSErr _WEDrag(Point mouseLoc, EventModifiers modifiers, UInt32 clickTime, WEHandle hWE);
  1501. pascal void _WEResolveURL(EventModifiers modifiers, SInt32 urlStart, SInt32 urlEnd, WEHandle hWE);
  1502.  
  1503. //    WEObjects.c (private)
  1504. pascal SInt32 _WELookupObjectType(FlavorType objectType, WEOHTableHandle hTable);
  1505. pascal OSErr _WEGetIndObjectType(SInt32 index, FlavorType *objectType, WEHandle hWE);
  1506. pascal OSErr _WENewObject(FlavorType objectType, Handle objectDataHandle, WEHandle hWE,
  1507.                     WEObjectDescHandle *hObjectDesc);
  1508. pascal OSErr _WEFreeObject(WEObjectDescHandle hObjectDesc);
  1509. pascal OSErr _WEDrawObject(WEObjectDescHandle hObjectDesc);
  1510. pascal Boolean _WEClickObject(Point hitPt, EventModifiers modifiers, UInt32 clickTime,
  1511.                                 WEObjectDescHandle hObjectDesc);
  1512. pascal OSErr _WEStreamObject(SInt16 destKind, FlavorType *theType, Handle *theData,
  1513.                 Boolean *canDisposeData, WEObjectDescHandle hObjectDesc);
  1514.  
  1515. //    WEScraps.c (private)
  1516. pascal OSErr _WEPrependStyle(Handle hStyleScrap, const WERunInfo *info, SInt32 offsetDelta);
  1517. pascal OSErr _WEAppendStyle(Handle hStyleScrap, const WERunInfo *info, SInt32 offset);
  1518. pascal OSErr _WEPrependObject(Handle hSoup, const WERunInfo *info, SInt32 offsetDelta);
  1519. pascal OSErr _WEAppendObject(Handle hSoup, const WERunInfo *info, SInt32 offset);
  1520. pascal OSErr _WEPutScrapHandle(FlavorType dataFlavor, Handle dataHandle);
  1521.  
  1522. //    WESelecting.c (private)
  1523. INLINE pascal void _WEClearHiliteBit(void); // Motorola 9-Jun-97
  1524. pascal SInt16 _WEGetContext(SInt32 offset, SInt32 *contextStart, SInt32 *contextEnd,
  1525.                         WEHandle hWE);
  1526. pascal SInt16 _WEGetRestrictedContext(SInt32 offset, SInt32 *contextStart, SInt32 *contextEnd,
  1527.                         WEHandle hWE);
  1528. pascal void _WEGetCaretRect(SInt32 offset, SInt16 direction, Rect *caretRect, WEHandle hWE);
  1529. pascal void _WEDrawCaret(SInt32 offset, SInt16 direction, Boolean useDualCaret, WEHandle hWE);
  1530. pascal void _WEBlinkCaret(WEHandle hWE);
  1531. pascal void _WEHiliteRange(SInt32 rangeStart, SInt32 rangeEnd, WEHandle hWE);
  1532. pascal SInt32 _WECrossDirectionBoundary(SInt32 offset, Boolean movingRight, WEHandle hWE);
  1533. pascal SInt32 _WEArrowOffset(SInt16 action, SInt32 offset, WEHandle hWE);
  1534. pascal void _WEDoArrowKey (SInt16 arrow, EventModifiers modifiers, WEHandle hWE);
  1535. pascal Boolean _WEScrollIntoView (SInt32 offset, WEHandle hWE);
  1536.  
  1537. // WESelectors.c (private)
  1538. extern WELookupTable _weMainSelectorTable[];
  1539. extern WELookupTable _weObjectHandlerSelectorTable[];
  1540. pascal void _WELookupSelector(const WELookupTable *table, WESelector selector, WEFieldDescriptor *desc);
  1541. pascal OSErr _WEGetField(const WELookupTable *table, WESelector selector, SInt32 *info, void *structure);
  1542. pascal OSErr _WESetField(const WELookupTable *table, WESelector selector, SInt32 *info, void *structure);
  1543.  
  1544. // WEUtilities.c (private)
  1545. pascal void _WEForgetHandle(Handle *h);
  1546. pascal Boolean _WESetHandleLock(Handle h, Boolean lock);
  1547. pascal void _WEBlockClr(void *block, Size blockSize);
  1548. pascal Boolean _WEBlockCmp(const void *block1, const void *block2, Size blockSize);
  1549. pascal void _WEReorder(SInt32 *a, SInt32 *b);
  1550. pascal OSErr _WEAllocate(Size blockSize, UInt32 allocFlags, Handle *h);
  1551. pascal OSErr _WESplice(Handle h, const void *blockPtr, SInt32 blockSize, SInt32 offset);
  1552.  
  1553. #if WASTE_SHARED_LIBRARY
  1554. #pragma internal reset
  1555. #endif
  1556.  
  1557. #ifdef __cplusplus
  1558. }
  1559. #endif
  1560.